package com.elec.util;

public class FileOperationDetector {
    
    public static boolean detectFileOperations(String code) {
        if (code.contains("new File") || code.contains("Files.create") || code.contains("Files.delete")) {
            System.out.println("Warning: File operation detected in the code.");
            return true;
        }
        System.out.println("No file operations detected.");
        return false;
    }
    
    public static void main(String[] args) {
        String userCode = "import java.io.File;\n" +
                          "import java.nio.file.Files;\n" +
                          "import java.nio.file.Paths;\n\n" +
                          "// Deleting a file\n" +
                          "Files.deleteIfExists(Paths.get(\"test.txt\"));\n\n" +
                          "// Reading a file\n" +
                          "File file = new File(\"data.txt\");\n";
                          
        detectFileOperations(userCode);
    }
}